package br.com.fogas.medicao.application;

import br.com.fogas.medicao.R;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class LoadFragment {
	
	FragmentManager fragmentManager;

	public LoadFragment(FragmentManager fragmentManager) {
		this.fragmentManager = fragmentManager;
	}
	
	public void initializeFragment(boolean addBackStack, Fragment fragment, String tagId) {
		FragmentTransaction transaction = fragmentManager.beginTransaction();
		transaction.replace(R.id.frame_container, fragment);
		
		if(addBackStack) {
			transaction.addToBackStack(tagId);
		}
		
		transaction.commit();
	}
}
